const mysql = require('mysql')

const pool = mysql.createPool({
  host: 'localhost',
  user: 'root',
  password: '3051532wyp.',
  database: 's1709A'
})

// 执行语句 sql
function exec(sql) {
  return new Promise((resolve, reject) => {
    pool.query(sql, (err, data) => {
       if (err) {
         reject(err)
         return;
       }
       console.log(data, 'data----data')
       resolve(data)
    })
  })
}

module.exports = {
  exec
}

